package com.ebt.m.proposal_v2.dao.response;

import com.ebt.m.proposal_v2.bean.InsuranceOption;

import java.util.List;

public class ResponseMainDetail {

    private String accMaxAge; // 允许最大投保年龄 小于一岁时小数点后五位前两位表示月份，后三位表示天数
    private String accMinAge; // 允许最小投保年龄 小于一岁时小数点后五位前两位表示月份，后三位表示天数
    private String accOccupation; // 允许投保职业
    private String accSex; // 允许投保性别 0 不限制， 1 限制女性， 2 限制男性
    private int brandId;
    private Object brandMiniLogo;
    private String brandName;
    private String brandShortName;
    private String categoryName; // 险种类别
    private int compositionProperty; // 组合属性
    private String contractProperty; // 合同属性
    private String coverage;
    private String premium;
    private String coveragePeriod;
    private String paymentPeriod;
    private String coveragePeriodValue;
    private String paymentPeriodValue;
    private int productId;
    private String name;
    private String shortName;
    private int productCategoryId;
    private String productCode;
    private String thumbnail;
    private Object dateForSaleStart; // 未知
    private String description; // 产品描述
    private int hasDividends; // 分红性质
    private DefaultInsuredBean defaultInsured;
    private List<InsuranceOption> options;
    private ModelMapBean modelMap;
    private List<ResponseAttach> necessaryAddRisk;
    private BusinessConfig businessConfig;

    public BusinessConfig getBusinessConfig() {
        return businessConfig;
    }

    public void setBusinessConfig(BusinessConfig businessConfig) {
        this.businessConfig = businessConfig;
    }

    public String getAccMaxAge() {
        return accMaxAge;
    }

    public void setAccMaxAge(String accMaxAge) {
        this.accMaxAge = accMaxAge;
    }

    public String getAccMinAge() {
        return accMinAge;
    }

    public void setAccMinAge(String accMinAge) {
        this.accMinAge = accMinAge;
    }

    public String getAccOccupation() {
        return accOccupation;
    }

    public void setAccOccupation(String accOccupation) {
        this.accOccupation = accOccupation;
    }

    public String getAccSex() {
        return accSex;
    }

    public void setAccSex(String accSex) {
        this.accSex = accSex;
    }

    public int getBrandId() {
        return brandId;
    }

    public void setBrandId(int brandId) {
        this.brandId = brandId;
    }

    public Object getBrandMiniLogo() {
        return brandMiniLogo;
    }

    public void setBrandMiniLogo(Object brandMiniLogo) {
        this.brandMiniLogo = brandMiniLogo;
    }

    public String getBrandName() {
        return brandName;
    }

    public void setBrandName(String brandName) {
        this.brandName = brandName;
    }

    public String getBrandShortName() {
        return brandShortName;
    }

    public void setBrandShortName(String brandShortName) {
        this.brandShortName = brandShortName;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    public int getCompositionProperty() {
        return compositionProperty;
    }

    public void setCompositionProperty(int compositionProperty) {
        this.compositionProperty = compositionProperty;
    }

    public String getContractProperty() {
        return contractProperty;
    }

    public void setContractProperty(String contractProperty) {
        this.contractProperty = contractProperty;
    }

    public String getCoverage() {
        return coverage;
    }

    public void setCoverage(String coverage) {
        this.coverage = coverage;
    }

    public String getCoveragePeriod() {
        return coveragePeriod;
    }

    public void setCoveragePeriod(String coveragePeriod) {
        this.coveragePeriod = coveragePeriod;
    }

    public Object getDateForSaleStart() {
        return dateForSaleStart;
    }

    public void setDateForSaleStart(Object dateForSaleStart) {
        this.dateForSaleStart = dateForSaleStart;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public int getHasDividends() {
        return hasDividends;
    }

    public void setHasDividends(int hasDividends) {
        this.hasDividends = hasDividends;
    }

    public ModelMapBean getModelMap() {
        return modelMap;
    }

    public void setModelMap(ModelMapBean modelMap) {
        this.modelMap = modelMap;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPaymentPeriod() {
        return paymentPeriod;
    }

    public void setPaymentPeriod(String paymentPeriod) {
        this.paymentPeriod = paymentPeriod;
    }

    public String getPremium() {
        return premium;
    }

    public void setPremium(String premium) {
        this.premium = premium;
    }

    public int getProductCategoryId() {
        return productCategoryId;
    }

    public void setProductCategoryId(int productCategoryId) {
        this.productCategoryId = productCategoryId;
    }

    public String getProductCode() {
        return productCode;
    }

    public void setProductCode(String productCode) {
        this.productCode = productCode;
    }

    public int getProductId() {
        return productId;
    }

    public void setProductId(int productId) {
        this.productId = productId;
    }

    public String getShortName() {
        return shortName;
    }

    public void setShortName(String shortName) {
        this.shortName = shortName;
    }

    public String getThumbnail() {
        return thumbnail;
    }

    public void setThumbnail(String thumbnail) {
        this.thumbnail = thumbnail;
    }

    public List<ResponseAttach> getNecessaryAddRisk() {
        return necessaryAddRisk;
    }

    public void setNecessaryAddRisk(List<ResponseAttach> necessaryAddRisk) {
        this.necessaryAddRisk = necessaryAddRisk;
    }

    public String getCoveragePeriodValue() {
        return coveragePeriodValue;
    }

    public void setCoveragePeriodValue(String coveragePeriodValue) {
        this.coveragePeriodValue = coveragePeriodValue;
    }

    public String getPaymentPeriodValue() {
        return paymentPeriodValue;
    }

    public void setPaymentPeriodValue(String paymentPeriodValue) {
        this.paymentPeriodValue = paymentPeriodValue;
    }

    public List<InsuranceOption> getOptions() {
        return options;
    }

    public void setOptions(List<InsuranceOption> options) {
        this.options = options;
    }

    public DefaultInsuredBean getDefaultInsured() {
        return defaultInsured;
    }

    public void setDefaultInsured(DefaultInsuredBean defaultInsured) {
        this.defaultInsured = defaultInsured;
    }

    public void parseOptions() {
        if (options == null || options.size() == 0) {
            return;
        }
        for (InsuranceOption opt : options) {
            if (opt != null) {
                loadOption(opt);
            }
        }
        if (necessaryAddRisk == null || necessaryAddRisk.size() == 0) {
            return;
        }
        for (ResponseAttach attach : necessaryAddRisk) {
            if (attach != null) {
                attach.parseOptions();
            }
        }
    }

    private void loadOption(InsuranceOption opt) {
        if (opt.fieldName.equals("Coverage")) {
            coverage = opt.value;
            if (coverage == null || "".equals(coverage)) {
                coverage = opt.displayName;
            }
        }
        if (opt.fieldName.equals("Premium")) {
            premium = opt.value;
            if (premium == null || "".equals(premium)) {
                premium = opt.displayName;
            }
        }
        if (opt.fieldName.equals("CoveragePeriod")) {
            coveragePeriod = opt.displayName;
            coveragePeriodValue = opt.value;
        }
        if (opt.fieldName.equals("PaymentPeriod")) {
            paymentPeriod = opt.displayName;
            paymentPeriodValue = opt.value;
        }
    }

    public static class ModelMapBean {
        private List<String> value;
        private List<String> key;

        public List<String> getValue() {
            return value;
        }

        public void setValue(List<String> value) {
            this.value = value;
        }

        public List<String> getKey() {
            return key;
        }

        public void setKey(List<String> key) {
            this.key = key;
        }
    }

    public static class DefaultInsuredBean {
        /**
         * age : 0
         * profession : 1
         * sex : 1
         */
        private float age;
        private int profession;
        private int sex;

        public float getAge() {
            return age;
        }

        public void setAge(float age) {
            this.age = age;
        }

        public int getProfession() {
            return profession;
        }

        public void setProfession(int profession) {
            this.profession = profession;
        }

        public int getSex() {
            return sex;
        }

        public void setSex(int sex) {
            this.sex = sex;
        }
    }
}
